#自定义别名
grep "alias cls='clear'" ~/.bashrc > /dev/null
if [ $? -eq 0 ]; then
    echo "alias was seted."
else
cat >> ~/.bashrc <<-EOF
alias cls='clear'
alias apt='sudo apt'
alias apti='apt install -y'
alias aptr='apt remove -y'
alias apts='apt search'
alias aptu='apt update'
alias aptp='apt upgrade -y'
alias npm='sudo npm'
alias cnpm='sudo cnpm'
alias yarn='sudo yarn'
alias pip='sudo -H pip'
alias pip3='sudo -H pip3'
alias vim='sudo vim'
alias vi='vim'
alias git='sudo git'
alias l='ls -al'
alias ll='ls -l'
alias mv='sudo mv -i'
alias cp='sudo cp -i'
alias rm='sudo rm -i'
alias reboot='sudo shutdown -r now'
alias halt='sudo shutdown -h now'
export PAGER=most
export BROWSER=firefox
export EDITOR=vim
export LANG=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
xrandr -s 1440x900_60
EOF
source ~/.bashrc
fi

sudo apt update
sudo apt upgrade -y

#组安装
sudo apt install -y tasksel
#sudo tasksel

sudo apt install -y --fix-broken virtualbox-guest-dkms
sudo apt install -y --fix-broken open-vm-tools
sudo apt install -y --fix-broken build-essential
sudo apt install -y --fix-broken linux-headers-$(uname -r) dkms

sudo apt install -y language-pack-gnome-zh-hans 
sudo apt install -y language-pack-zh-hans-base 
sudo apt install -y language-pack-zh-hans 
sudo apt install -y language-pack-gnome-zh-hans-base
sudo apt install -y gnome-tweak-tool 
sudo apt install -y gnome-shell-extensions 
sudo apt install -y chrome-gnome-shell

sudo apt install -y net-tools

#输入法
sudo apt install -y ibus ibus-table-wubi ibus-input-pad
sudo apt install -y fcitx fcitx-table-wubi

#常用开发工具
sudo apt install -y software-properties-common
sudo apt install -y cpp gcc g++ 
sudo apt install -y gdb glibc-doc autoconf
sudo apt install -y chromium-browser
sudo apt install -y firefox
sudo apt install -y terminator
sudo apt install -y wget curl git tree
sudo apt install -y vim neovim
sudo apt install -y vim-scripts vim-doc vim-addon-manager
sudo apt install -y openssh-server
sudo apt install -y default-jdk
sudo apt install -y golang rustc cargo
sudo apt install -y kate kwrite
sudo apt install -y gedit gedit-dev gedit-plugins
sudo apt install -y manpages manpages-dev 
sudo apt install -y manpages-posix manpages-posix-dev 
sudo apt install -y manpages-zh most

#nodejs相关
sudo apt install -y nodejs npm
sudo npm config set registry http://registry.npmmirror.com
sudo npm i -g npm
sudo npm i -g cnpm --registry http://registry.npmmirror.com
sudo npm i -g yarn --registry http://registry.npmmirror.com
sudo npm i -g pnpm --registry http://registry.npmmirror.com

#python相关
sudo apt install -y python3
sudo apt install -y python3-pip
sudo apt install -y python3-setuptools
sudo apt install -y python3-ipython
sudo apt install -y python-is-python3
sudo apt install -y pipx

[ -e ~/.pip ] || sudo mkdir ~/.pip
[ -e ~/.pip/pip.conf ] || sudo touch ~/.pip/pip.conf
sudo chmod a+w ~/.pip/pip.conf
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set install.trusted-host mirrors.aliyun.com

sudo python -m pip install --upgrade pip
sudo pip install --user ptpython --trusted-host mirrors.aliyun.com

#命令行文件管理器
pip install ranger-fm --trusted-host mirrors.aliyun.com
#语法检查
pip install --user flake8 --trusted-host mirrors.aliyun.com
#自动代码提示
pip install --user jedi --trusted-host mirrors.aliyun.com
#自动导入模块
pip install --user isort --trusted-host mirrors.aliyun.com
#代码格式化
pip install --user yapf --trusted-host mirrors.aliyun.com
#通过安装 pygments扩展让vim支持 50+ 种语言（包括 go/rust/scala 等，基本覆盖所有主流语言
pip install pygments --trusted-host mirrors.aliyun.com

#vscode
sudo apt install -y code

#fish & oh my fish
sudo apt install -y fish

#zsh
sudo apt install -y bat zsh 
sudo apt install -y zsh-autosuggestions autojump zsh-syntax-highlighting

#space-vim
sudo apt install -y cscope
sudo curl -sLf https://spacevim.org/cn/install.sh | bash